package com.designpattern.prototype.demo2;

import java.util.Date;
import java.util.Objects;

//视屏的类

/**
 * 1.实现一个接口
 * 2.重写一个方法
 */
public class Video implements Cloneable {
    private String name;
    private Date createTime;

    public Video() {
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Object obj = super.clone();
//        实现深克隆
        Video v = (Video) obj;
        v.createTime = (Date) this.createTime.clone();
        return v;
    }

    @Override
    public String toString() {
        return "Video{" +
                "name='" + name + '\'' +
                ", createTime=" + createTime +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Video video = (Video) o;
        return Objects.equals(name, video.name) && Objects.equals(createTime, video.createTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, createTime);
    }

    public Video(String name, Date createTime) {
        this.name = name;
        this.createTime = createTime;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }



}
